<template>
  <div class="mobile-container">
    <van-skeleton title avatar :row="10" :loading="!state.loading">
      <van-tabs type="card" v-model="state.active"  :ellipsis="false" :swipe-threshold="3">
        <van-tab v-for="(item,index) in state.value" :title="item.title" :key="index">
          <notifylist :path="item.path" :args="item.args"></notifylist>
        </van-tab>
      </van-tabs>
    </van-skeleton>

  </div>
</template>

<script lang="ts">
import {useRouter} from "vue-router";
import {useStore} from "vuex";
import {Notify} from "vant";
import {reactive, ref} from "vue";
import notifylist from "./mobile_notify_list.vue";
import {iListNode} from "../../../../interface";
import {IClubRsp} from "@/lib/recover";
import {getAllData} from "@/lib/tools";


export default {
  name: "mobile_view_notify.vue",
  setup() {
    const debug = true;
    const state = reactive({
      value:[] as {
        path:string,
        title:string,
        args:string,
      }[],
      loading:false,
      active:1
    })
    const club_manager = reactive({
      club_list:[] as IClubRsp[]
    })
    const router = useRouter();
    // const store = useStore();
    state.value.push({
      path:'self/received',
      args:'&type=2',
      title:"审核消息"
    })

    state.value.push({
      path:'self/received',
      args:'&type=0',
      title:"系统消息"
    })
    state.value.push({
      path:'self/received',
      args:'&type=3',
      title:"点对点消息"
    })

    getAllData<IClubRsp>("api/user/self/club",0).then(obj=>{
      club_manager.club_list=obj;
      for(const item of club_manager.club_list){
        state.value.push({
          path:'club/'+item.id,
          args:'',
          title:item.name
        })
      }
      state.loading=true;
    })
    return {
      router,state,
    }
  },
  components:{
    notifylist
  }
}
</script>

<style scoped>
.mobile-container {
  padding-top: 30px;
  padding-bottom: 200px;
}
</style>